<template>
	<view class="page">
		<view>
			<head1 class="nav_top"
				:style="'height:' +  demo.height + 'px;' + 'padding-top:' + demo.top + 'px;padding-bottom:10px'"
				:nav="title">
			</head1>
		</view>
		<view class="waringMain">
			<view class="index_line" :style="'margin-top:'+(demo.height+demo.top+10)+'px'"></view>
			<!-- <view class="waringMainList">
				<view class="top dis_flex">
					<view class="wml_left">
						<view class="line"></view>
						<text>三类人员多证</text>
					</view>
					<div class="wml_right">
						<text :style="slryTitle=='暂无预警信息'?'color:pink':'color:red'">{{slryTitle}}</text>
						<image v-if="slrytsjbbc.length!=0" src="../../static/icon/jinggao.png" mode=""></image>
					</div>
				</view>
				<view class="bottom" v-for="(item,index) in slrytsjbbc">
					<view>证书编号：{{item.zczsh}}</view>
					<view>证书类型：{{item.zslx_mc}}</view>
					<view>证书级别：{{item.zsjb_mc}}</view>
					<view v-if="item.zsyxqjssj!='' && item.zsyxqjssj!=undefined">有效期：{{item.zsyxqjssj}}</view>
				</view>
			</view> -->

			<view class="waringMainList">
				<view class="top dis_flex">
					<view class="wml_left">
						<view class="line"></view>
						<text>建造师B证不符</text>
					</view>
					<div class="wml_right">
						<text :style="slrybzjTitle=='暂无预警信息'?'':'color:red'">{{slrybzjTitle}}</text>
						<image v-if="slrybzjzssfzyj.length!=0" src="../../static/icon/jinggao.png" mode=""></image>
					</div>
				</view>
				<view class="bottom" v-for="(item,index) in slrybzjzssfzyj">
					<view>证书编号：{{item.zczsh}}</view>
					<view>证书类型：{{item.zslx_mc}}</view>
					<view>证书级别：{{item.zsjb_mc}}</view>
					<view v-if="item.zsyxqjssj!='' && item.zsyxqjssj!=undefined">有效期：{{item.zsyxqjssj}}</view>
				</view>
			</view>
			<view class="waringMainList">
				<view class="top dis_flex">
					<view class="wml_left">
						<view class="line"></view>
						<text>跨单位注册</text>
					</view>
					<div class="wml_right">
						<text :style="zczsdTitle=='暂无预警信息'?'':'color:red'">{{zczsdTitle}}</text>
						<image v-if="zczsdwbf.length!=0" src="../../static/icon/jinggao.png" mode=""></image>
					</div>
				</view>
				<view class="bottom" v-for="(item,index) in zczsdwbf">
					<view>证书编号：{{item.zczsh}}</view>
					<view>证书类型：{{item.zslx_mc}}</view>
					<view>证书级别：{{item.zsjb_mc}}</view>
					<view v-if="item.zsyxqjssj!='' && item.zsyxqjssj!=undefined">有效期：{{item.zsyxqjssj}}</view>
				</view>
			</view>
			<view class="waringMainList">
				<view class="top dis_flex">
					<view class="wml_left">
						<view class="line"></view>
						<text>证书重复</text>
					</view>
					<div class="wml_right">
						<text :style="tyzlTitle=='暂无预警信息'?'':'color:red'">{{tyzlTitle}}</text>
						<image v-if="tyzltyzsdg.length!=0" src="../../static/icon/jinggao.png" mode=""></image>
					</div>
				</view>
				<view class="bottom" v-for="(item,index) in tyzltyzsdg">
					<view>证书编号：{{item.zczsh}}</view>
					<view>证书类型：{{item.zslx_mc}}</view>
					<view>证书级别：{{item.zsjb_mc}}</view>
					<view v-if="item.zsyxqjssj!='' && item.zsyxqjssj!=undefined">有效期：{{item.zsyxqjssj}}</view>
				</view>
			</view>
			<view class="waringMainList">
				<view class="top dis_flex">
					<view class="wml_left">
						<view class="line"></view>
						<text>建造师专业重复</text>
					</view>
					<div class="wml_right">
						<text :style="jzsTitle=='暂无预警信息'?'':'color:red'">{{jzsTitle}}</text>
						<image v-if="tyzltyzsdg.length!=0" src="../../static/icon/jinggao.png" mode=""></image>
					</div>
				</view>
				<view class="bottom" v-for="(item,index) in jzsdbzybf">
					<view>证书编号：{{item.zczsh}}</view>
					<view>证书类型：{{item.zslx_mc}}</view>
					<view>证书级别：{{item.zsjb_mc}}</view>
					<view v-if="item.zsyxqjssj!='' && item.zsyxqjssj!=undefined">有效期：{{item.zsyxqjssj}}</view>
				</view>
			</view>
			<view class="waringMainList">
				<view class="top dis_flex">
					<view class="wml_left">
						<view class="line"></view>
						<text>人员项目锁证</text>
					</view>
					<div class="wml_right">
						<text :style="xmlockTitle=='暂无预警信息'?'':'color:red'">{{xmlockTitle}}</text>
						<image v-if="xmlock.length!=0" src="../../static/icon/jinggao.png" mode=""></image>
					</div>
				</view>
				<view class="bottom" v-for="(item,index) in xmlock">
					<view>证书编号：{{item.zczsh}}</view>
					<view>证书类型：{{item.zslx_mc}}</view>
					<view>证书级别：{{item.zsjb_mc}}</view>
					<view v-if="item.zsyxqjssj!='' && item.zsyxqjssj!=undefined">有效期：{{item.zsyxqjssj}}</view>
				</view>
			</view>
			<view class="index_line"></view>
		</view>
	</view>
</template>
<script>
	import head1 from '../head/head.vue'
	export default {
		components: {
			head1
		},
		data() {
			return {
				title: '分析预警',
				demo: {
					top: '',
					height: ''
				},
				dataList: {
					userId: '',
					sfzh: ''
				},
				slryTitle: '', //三类人员多证
				slrybzjTitle: '', // 建造师B证不符
				zczsdTitle: '', //跨单位注册
				tyzlTitle: '', //证书重复
				jzsTitle: '', //建造师专业重复
				xmlockTitle: '', //项目锁定
				slrytsjbbc: [],
				slrybzjzssfzyj: [],
				zczsdwbf: [],
				tyzltyzsdg: [],
				jzsdbzybf: [],
				xmlock: []
			}
		},
		computed: {
			userid() {
				return this.$store.state.userId
			},
			sfzh() {
				return this.$store.state.sfzh
			}
		},
		created() {
			const demo = uni.getMenuButtonBoundingClientRect()
			this.demo.top = demo.top
			this.demo.height = demo.height
			this.dataList.userId = this.userid
			this.dataList.sfzh = this.sfzh
			this.getAnalysis(this.dataList)
		},

		methods: {
			getAnalysis(data) {
				let _this = this;
				let dataMain = {}
				uni.showLoading({
					title: '数据加载中...'
				})
				setTimeout(function() {
					_this.$myResquest.getAnalysisWarn(data).then(res => {
						if (res.data.code == 200) {
							_this.dataMain = JSON.parse(res.data.data)
							//三类人员
							if (_this.dataMain.slrytsjbbc.length == 0) {
								_this.slryTitle = '暂无预警信息'
							} else {
								_this.slrytsjbbc = _this.dataMain.slrytsjbbc
								_this.slryTitle = _this.dataMain.slrytsjbbc[0].title
							}
							// 建造师
							if (_this.dataMain.slrybzjzssfzyj.length == 0) {
								_this.slrybzjTitle = '暂无预警信息'
							} else {
								_this.slrybzjzssfzyj = _this.dataMain.slrybzjzssfzyj
								_this.slrybzjTitle = _this.dataMain.slrybzjzssfzyj[0].title
							}
							// 跨单位注册
							if (_this.dataMain.zczsdwbf.length == 0) {
								_this.zczsdTitle = '暂无预警信息'
							} else {
								_this.zczsdwbf = _this.dataMain.zczsdwbf
								_this.zczsdTitle = _this.dataMain.zczsdwbf[0].title
							}
							// 证书重复
							if (_this.dataMain.tyzltyzsdg.length == 0) {
								_this.tyzlTitle = '暂无预警信息'
							} else {
								_this.tyzltyzsdg = _this.dataMain.tyzltyzsdg
								_this.tyzlTitle = _this.dataMain.tyzltyzsdg[0].title
							}
							// 建造师专业重复
							if (_this.dataMain.jzsdbzybf.length == 0) {
								_this.jzsTitle = '暂无预警信息'
							} else {
								_this.jzsdbzybf = _this.dataMain.jzsdbzybf
								_this.jzsTitle = _this.dataMain.jzsdbzybf[0].title
							}
							// 建造师专业重复
							if (_this.dataMain.jzsdbzybf.length == 0) {
								_this.jzsTitle = '暂无预警信息'
							} else {
								_this.jzsdbzybf = _this.dataMain.jzsdbzybf
								_this.jzsTitle = _this.dataMain.jzsdbzybf[0].title
							}
							// 项目锁证
							if (_this.dataMain.xmlock.length == 0) {
								_this.xmlockTitle = '暂无预警信息'
							} else {
								_this.xmlock = _this.dataMain.xmlock
								_this.xmlockTitle = _this.dataMain.xmlock[0].title
							}
							// for (var i = 0; i < _this.dataMain.length; i++) {
							// 	// 跨单位注册
							// 	if (_this.dataMain[i].type == 'zczsdwbf') {
							// 		_this.zczsdwbf = _this.dataMain[i]
							// 	}else{
							// 		_this.zczsdTitle='暂无预警信息'
							// 	}
							// 	// 证书重复
							// 	if (_this.dataMain[i].type == 'tyzltyzsdg') {
							// 		_this.tyzltyzsdg = _this.dataMain[i]
							// 	}else{
							// 		_this.tyzlTitle='暂无预警信息'
							// 	}
							// 	// 建造师专业重复
							// 	if (_this.dataMain[i].type == 'jzsdbzybf') {
							// 		_this.jzsdbzybf = _this.dataMain[i]
							// 	}else{
							// 		_this.jzsTitle='暂无预警信息'
							// 	}
							// 	// 项目锁定
							// 	if (_this.dataMain[i].type == 'xmlock') {
							// 		_this.xmlock = _this.dataMain[i]

							// 	}else{
							// 		_this.xmlockTitle='暂无预警信息'
							// 	}
							// }
							uni.hideLoading()
						}
					})
				}, 1000)

			}
		}
	}
</script>
<style lang="scss" scoped>
	.waringMain {
		background-color: #f9f9f9;
		height: 100%;
		position: absolute;

		.waringMainList {
			width: 658rpx;
			    background: #ffffff;
			    border-radius: 20rpx;
			    margin: 40rpx auto;
			    padding: 0 28rpx;
			    box-sizing: border-box;

			.top {
				height: 100%;
				padding-top: 20rpx;
				padding-bottom: 20rpx;
				box-sizing: border-box;

				.wml_left {
					display: flex;
					align-items: center;

					.line {
						width: 4rpx;
						height: 33rpx;
						background: #4bb1af;
						border-radius: 2rpx;
					}

					text {
						font-size: 32rpx;
						font-family: PingFang SC, PingFang SC-Bold;
						font-weight: 700;
						text-align: left;
						color: #4bb1af;
						line-height: 36rpx;
						margin-left: 20rpx;
					}
				}

				.wml_right {
					text {
						width: 142rpx;
						height: 24rpx;
						font-size: 24rpx;
						font-family: PingFang SC, PingFang SC-Medium;
						font-weight: 500;
						text-align: left;
						color: #999999;
						line-height: 36rpx
					}

					image {
						width: 40rpx;
						height: 36rpx;
					}
				}
			}

			.bottom {
				padding: 4rpx 0 26rpx 20rpx;
				width: 100%;
				background: #f9f9f9;
				margin: 10rpx 0;
				border-radius: 20rpx;
				font-size: 24rpx;

				text {
					font-size: 24rpx;
					font-family: PingFang SC, PingFang SC-Medium;
					font-weight: 500;
					text-align: left;
					color: #ff0000;
					line-height: 36rpx;
				}
			}
		}


	}

	.meishuju {
		width: 750rpx;
		text-align: center;
		height: 250rpx;
		line-height: 250rpx;
	}
</style>
